package com.godpaper.chessGameHall.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import it.gotoandplay.smartfoxserver.SmartFoxClient;
	
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	
	import mx.controls.Alert;
	import mx.events.CloseEvent;
	import mx.rpc.IResponder;

	public class CommandBase implements ICommand, IResponder
	{
		protected var sfClient:SmartFoxClient;
		
		public function CommandBase()
		{
			// Create server instance
			this.sfClient = new SmartFoxClient(true);
		}

		public function execute(event:CairngormEvent):void
		{
		}
		
		virtual public function result(data:Object):void
		{
//			Alert.show(data.toString());
		}
		
		public function fault(info:Object):void
		{
//			Alert.show(info.toString());
			Alert.show("抱歉！后台程序出错！重试或取消?\n"+
				info.message.faultCode+";\n"+
				info.message.faultDetail,"出错",3,null,function(event:CloseEvent):void
			{
				if(event.detail==Alert.YES)
				{
					navigateToURL(new URLRequest("http://www.godpaper.com"), "_self");
				}
			},null);
		}
		
	}
}